package collision;




public class Castle extends Thing
{

	private int health;
	private int maxHealth;
	private static String iiString  = "castle3.png";
	private final int DAMAGE_PER_ENEMY = 20;
	
    /**
     * Castle Constructor
     */
    public Castle() {
    	super(-140, 115, iiString);
    	health = 500;
    	maxHealth = 500;
    }
    
    /**
     * Returns current health of the castle.
     * 
     * @return  health of castle
     */
    public int getHealth()
    {
    	return health;
    }
    
    /**
     * get full health cost
     * 
     * @return  cost to upgrade the castle to full health
     */
    public int fullHealthCost()
    {
    	return (maxHealth-health)*2;
    }
    
    /**
     * The maximum health the castle can have
     * 
     * @return  The maximum health the castle can have
     */
    public int getMaxHealth()
    {
    	return maxHealth;
    }
    
    /**
     * Set the castle max health
     * 
     * @param  max	The new maximum.
     */
    public void setMaxHealth(int max)
    {
    	maxHealth = max;
    }
    
    /**
     * Set the castle health
     * 
     * @param  n	The new health.
     */
    public void setHealth(int n)
    {
    	health = n;
    }
    
    
    /**
     * Add to max health
     * 
     * @param  n    add to the current max health
     */
    public void addToMaxHealth(int n)
    {
    	maxHealth += n;
    	health += n;
    }
    
    /**
     * Add to health
     * 
     * @param  n    add to the current health
     */
    public void addHealth(int n)
    {
    	if(health+n<=maxHealth)
    		health += n;
    	else
    		health = maxHealth;
    }
    
    

    /**
     * Enemy has entered the castle.  Subtracts the correct amount of health when an enemy enters the castle.
     */
    public void enemyEntered()
    {
    	health = health - DAMAGE_PER_ENEMY;
    }
    
    
}
